import java.util.Scanner;

public class Test05 {
    static final int MOD = 1000000007;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        long[] dp = new long[n + 1];
        dp[1] = 0;
        dp[2] = 3;
        dp[3] = 18;
        for (int i = 4; i <= n ; i++) {
            dp[i] = (2 * dp[i -1] + dp[i -2]) % MOD;
        }
        System.out.println(dp[n]);

    }


}
